package cn.itsource.org.domain;

import cn.itsource.basic.domain.BaseTreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data
@Table(name = "t_department")
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "部门对象", description = "就是个对象，别问了")
public class Department extends BaseTreeNode<Department> {

    //部门编号
    @ApiModelProperty(value = "部门编号")
    @Size(min = 3,max = 6,message = "请输入3到6位之间的地黄丸")
    private String sn;

    //部门名称
    @ApiModelProperty(value = "部门名称")
    @NotBlank(message = "部门名称不能为空")
    private String name;

    //状态 1：启动 0.禁用  int默认值0 Integer默认值null
    @ApiModelProperty(value = "部门状态 1：启动 0.禁用")
    private Integer state;

    //管理员id  对应t_employee的主键id
    @Column(name = "manager_id")
    private Long managerId;

    //父id
    @Column(name = "parent_id")
    private Long parentId;

    //先不管
    @Column(name = "dir_path")
    private String dirPath;

    /**
     * 部门经理名字
     */
    @Transient
    private String managerName;

    /**
     * 上级部门名称
     */
    @Transient
    private String parentName;

    /**
     * 上级部门的ids
     */
    @Transient
    private Long[] parentIds;


}
